package service;

import java.util.ArrayList;
import java.util.List;
import model.Order;

public class OrderService {
    private List<Order> orders = new ArrayList();

    public OrderService() {
    }

    public void placeOrder(Order order) {
        this.orders.add(order);
    }

    public Order getOrder(int id) {
        return (Order)this.orders.stream().filter((o) -> {
            return o.getId() == id;
        }).findFirst().orElse((Order) null);
    }

    public List<Order> listOrders() {
        return new ArrayList(this.orders);
    }

    public void processRefund(int orderId) {
    }
}
